<template>

	<div>

		<div>
			<h2>修改头像</h2>

			<img style="width: 10vw;height: 10vw;" :src=" $ip + '/api/public/showimg/' +  $store.state.user.pic" />


		</div>

		<div>

			<p>图片: <input type="file" ref="img"></p>

			<button @click="doImg()">确认修改图片</button>

		</div>

	</div>

</template>



<script>
	export default {

		data() {
			return {
				
			}
		},
		methods: {
			doImg() {

				let fd = new FormData();

				let filex = this.$refs.img.files[0];
				console.log(filex)
				fd.append("mypic", filex)
				this.$postf("/api/user/updatePic", fd)
					.then((resp) => {
						this.$store.state.user.pic = resp.data.data + "?x=" + (new Date().getMilliseconds());
						console.log("修改成功")
					})

			}
		}






	}
</script>

<style>
</style>
